<?php if (!defined('THINK_PATH')) exit();?><html>
<head>
    <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>微信支付样例-订单查询</title>
    <style>
        table{ width: 85%; margin: 0 auto;}
        th{ background: #dcdcdc;}
        th,td{ text-align: center; padding: 4px 0;}
    </style>
    <!--<script type="text/javascript" src="//apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>-->
</head>
<body>
<form action="/index.php/Wxpay/Query/localorder" method="post">
    <div style="margin-left:2%;color:#f00">记录在本地数据库的微信订单号查询：</div><br/>
    <div style="margin-left:2%;">商品类型：</div><br/>
    <select type="" style="width:96%;height:35px;margin-left:2%;" name="product_type">
        <option value="测试">测试</option>
        <option value="物业费">物业费</option>
        <option value="购买水果">购买水果</option>
    </select><br /><br />
    <div style="margin-left:2%;">支付完成时间段：格式（20160203）</div><br/>
    <input type="text" style="width:96%;height:35px;margin-left:2%;" name="start" /><br /><br />
    <input type="text" style="width:96%;height:35px;margin-left:2%;" name="end" /><br /><br />
    <div style="margin-left:2%;">用户openid：</div><br/>
    <input type="text" style="width:96%;height:35px;margin-left:2%;" name="openid" /><br /><br />
    <div style="margin-left:2%;">是否为已成功交易：</div><br/>
    <div style="margin-left:2%;">
        是<input type="radio" checked="checked" name="trade_state" value="SUCCESS" />
        否<input type="radio" name="trade_state" value="FAIL" />
    </div>
    <div align="center">
        <input type="submit" value="查询" style="width:210px; height:50px; border-radius: 15px;background-color:#FE6714; border:0px #FE6714 solid; cursor: pointer;  color:white;  font-size:16px;" type="button" />
    </div>
</form>
<?php if(!defined("page")): if(isset($data)): ?><table>
            <tbody>
            <tr>
                <?php if(is_array($return_param)): $i = 0; $__LIST__ = $return_param;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i; if(array_search($key, array('','openid','is_subscribe','trade_type','total_fee','transaction_id','out_trade_no','time_end','product_type','is_enough','trade_state'))): ?><th><?php echo ($vo); ?></th><?php endif; endforeach; endif; else: echo "" ;endif; ?>
                <th>操作</th>
            </tr>
            <?php if(is_array($data)): $i = 0; $__LIST__ = $data;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr>
                    <?php if(is_array($vo)): $i = 0; $__LIST__ = $vo;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$voo): $mod = ($i % 2 );++$i; if(array_search($key, array('','openid','is_subscribe','trade_type','total_fee','transaction_id','out_trade_no','time_end','product_type','is_enough','trade_state'))): if($key == 'is_subscribe'): if($voo == Y): ?><td>关注</td>
                                    <?php else: ?><td>未关注</td><?php endif; ?>
                                <?php elseif($key == 'trade_type'): ?>
                                <td><?php echo ($voo); ?></td>
                                <?php elseif($key == 'total_fee'): ?>
                                <td><?php echo ($voo/100); ?>元</td>
                                <?php elseif($key == 'is_enough'): ?>
                                    <?php if($voo == 'Y'): ?><td>是</td>
                                        <?php else: ?><td>否</td><?php endif; ?>
                                <?php elseif($key == 'time_end'): ?>
                                <td><?php echo ($voo); ?></td>
                                <?php elseif($key == 'trade_state'): ?>
                                    <?php if($voo == 'SUCCESS'): ?><td>成功</td>
                                        <?php else: ?><td>未成功</td><?php endif; ?>
                                <?php else: ?><td><?php echo ($voo); ?></td><?php endif; endif; endforeach; endif; else: echo "" ;endif; ?>
                    <td><a href="<?php echo U('Query/wxorder',array('transaction_id'=>$vo['transaction_id']));?>">微信端详情</a></td>
                </tr><?php endforeach; endif; else: echo "" ;endif; ?>
            </tbody>
        </table>
        <?php if(($page) > "1"): ?><a href="<?php echo U('Query/localorder',array('page'=>1,'where'=>$where));?>">第1页</a><?php endif; ?>
        <?php if(($page) > "2"): ?><a href="<?php echo U('Query/localorder',array('page'=>$page-1,'where'=>$where));?>">第<?php echo ($page-1); ?>页</a><?php endif; ?>
        <span>第<?php echo ($page); ?>页</span>
        <?php if(($page) < $count-1): ?><a href="<?php echo U('Query/localorder',array('page'=>$page+1,'where'=>$where));?>">第<?php echo ($page+1); ?>页</a><?php endif; ?>
        <?php if(($page) < $count): ?><a href="<?php echo U('Query/localorder',array('page'=>$count,'where'=>$where));?>">第<?php echo ($count); ?>页</a><?php endif; ?>
        <span> / 共<?php echo ($count); ?>页</span><?php endif; endif; ?>
</body>
</html>